import React from "react";
import PropType from "prop-types";
//函数组件,props传参无需this.props接受,也没有this,形参直接接受
export default function Navbar(props) {
  let { content, leftShow, rightShow, bg } = props;
  Navbar.propTypes = {
    content: PropType.string,
    leftShow: PropType.bool,
    rightShow: PropType.bool,
    bg: PropType.string,
  };
  Navbar.defaultProps = {
    content: "内容",
    leftShow: true,
    rightShow: true,
    bg: "green",
  };
  return (
    <section>
      <div className="navbar">
        {leftShow ? <div>返回</div> : "0"}
        <div style={{ background: bg }}>{content}</div>
        {rightShow ? <div>回到首页</div> : "0"}
      </div>
    </section>
  );
}
